package com.px.chapter_Dec_1.thread;

import com.px.chapter_Dec_1.textt.User;

public class Test1 implements Runnable{
    @Override
    public void run() {
        for (int i=1;i<=100;i++){
            if (i%2==0)
                System.out.println(i+Thread.currentThread().getName());
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
     }


    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(new Test1(),"偶");
        Thread thread1 =new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i=1;i<=100;i++){
                    if (i%2!=0)
                        System.out.println(i+Thread.currentThread().getName());
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
        }


        },"奇");
        thread.start();
        thread1.start();

    }
}
